import halogen


class ProblemSchema(halogen.Schema):
    type = halogen.Attr()
    title = halogen.Attr()
    status = halogen.Attr()
    detail = halogen.Attr()
    instance = halogen.Attr()


class UserSchema(halogen.Schema):
    """用户基本资料/users
    
    用户编号      userID        UUID
    头像          avatar        URL
    昵称          nickname      Text
    性别          gender        Text
    出生日期      birthday      Date
    地区          district      JSON
    擅长位置      prefPosition  JSON
    身高          height        Integer
    体重          weight        Integer
    惯用脚        prefFoot      Text
    个人宣言      declaration   Text
    真实姓名      realname      Text
    身份证号      IDCardNumber  Text
    身份证正反照  IDCardPhoto   JSON
    手机号码      mobile        Text
    邮箱          email         Text
    密码          password      Text
    注册时间      createdTime   DateTime
    状态          status        Integer
    
    地区格式:
        {"Province":"北京市","Prefectural":"海淀区","County":"中关村"}
    擅长位置:
        ["1", "2"]
    
    Auto Generated Code.
    """
    self = halogen.Link(attr=lambda arg: '#self')
    userID = halogen.Attr(attr='userid')
    avatar = halogen.Attr()
    nickname = halogen.Attr()
    gender = halogen.Attr()
    birthday = halogen.Attr(
        attr_type=halogen.types.ISOUTCDate()
    )
    district = halogen.Attr()
    prefPosition = halogen.Attr(attr='prefposition')
    height = halogen.Attr()
    weight = halogen.Attr()
    prefFoot = halogen.Attr(attr='preffoot')
    declaration = halogen.Attr()
    realname = halogen.Attr()
    IDCardNumber = halogen.Attr(attr='idcardnumber')
    IDCardPhoto = halogen.Attr(attr='idcardphoto')
    mobile = halogen.Attr()
    email = halogen.Attr()
    password = halogen.Attr()
    createdTime = halogen.Attr(
        attr_type=halogen.types.ISOUTCDateTime(),
        attr='createdtime'
    )
    status = halogen.Attr()


class UserCollection(halogen.Schema):
    self = halogen.Link(attr=lambda arg: '#self')
    next = halogen.Link(attr=lambda arg: '#next')
    prev = halogen.Link(attr=lambda arg: '#prev')
    users = halogen.Embedded(
        halogen.types.List(UserSchema)
    )


class ClubSchema(halogen.Schema):
    """俱乐部基本资料/clubs
    
    俱乐部编号  clubID       UUID
    名称        name         Text
    队徽        logo         URL
    背景图      background   URL
    创立城市    district     JSON
    创立日期    foundDate    Date
    口号        slogan       Text
    简介        intro        Text
    创始人      founder      UUID
    创建时间    createdTime  DateTime
    状态        status       Integer
    
    Auto Generated Code.
    """
    self = halogen.Link(attr=lambda arg: '#self')
    clubID = halogen.Attr(attr='clubid')
    name = halogen.Attr()
    logo = halogen.Attr()
    background = halogen.Attr()
    district = halogen.Attr()
    foundDate = halogen.Attr(
        attr_type=halogen.types.ISOUTCDate(),
        attr='founddate'
    )
    slogan = halogen.Attr()
    intro = halogen.Attr()
    founder = halogen.Attr()
    createdTime = halogen.Attr(
        attr_type=halogen.types.ISOUTCDateTime(),
        attr='createdtime'
    )
    status = halogen.Attr()


class ClubCollection(halogen.Schema):
    self = halogen.Link(attr=lambda arg: '#self')
    next = halogen.Link(attr=lambda arg: '#next')
    prev = halogen.Link(attr=lambda arg: '#prev')
    clubs = halogen.Embedded(
        halogen.types.List(ClubSchema)
    )


class HonorSchema(halogen.Schema):
    """俱乐部荣誉/honors
    
    ID          id           UUID
    名称        honor        Text
    描述        intro        Text
    获奖日期    dateCreated  Date
    俱乐部编号  clubID       UUID
    
    Auto Generated Code.
    """
    self = halogen.Link(attr=lambda arg: '#self')
    honorID = halogen.Attr(attr='id')
    honor = halogen.Attr()
    intro = halogen.Attr()
    dateCreated = halogen.Attr(
        attr_type=halogen.types.ISOUTCDate(),
        attr='datecreated'
    )
    clubID = halogen.Attr(attr='clubid')


class HonorCollection(halogen.Schema):
    self = halogen.Link(attr=lambda arg: '#self')
    next = halogen.Link(attr=lambda arg: '#next')
    prev = halogen.Link(attr=lambda arg: '#prev')
    honors = halogen.Embedded(
        halogen.types.List(HonorSchema)
    )


class MemberSchema(halogen.Schema):
    """俱乐部成员/members
    
    俱乐部编号  clubID       UUID
    用户编号    userID       UUID
    角色        role         Text
    加入时间    createdTime  DateTime
    状态        status       Integer
    
    角色/role
        创始人/founder
        管理员/manager
        成员/member
    
    Auto Generated Code.
    """
    self = halogen.Link(attr=lambda arg: '#self')
    clubID = halogen.Attr(attr='clubid')
    userID = halogen.Attr(attr='userid')
    role = halogen.Attr()
    createdTime = halogen.Attr(
        attr_type=halogen.types.ISOUTCDateTime(),
        attr='createdtime'
    )
    status = halogen.Attr()


class MemberCollection(halogen.Schema):
    self = halogen.Link(attr=lambda arg: '#self')
    next = halogen.Link(attr=lambda arg: '#next')
    prev = halogen.Link(attr=lambda arg: '#prev')
    members = halogen.Embedded(
        halogen.types.List(MemberSchema)
    )


class FollowerSchema(halogen.Schema):
    """关注/followers
    
    所有者    owner        UUID
    追随者    follower     UUID
    类型      type         Integer
    创建时间  createdTime  DateTime
    
    Auto Generated Code.
    """
    self = halogen.Link(attr=lambda arg: '#self')
    owner = halogen.Attr()
    follower = halogen.Attr()
    type = halogen.Attr()
    createdTime = halogen.Attr(
        attr_type=halogen.types.ISOUTCDateTime(),
        attr='createdtime'
    )


class FollowerCollection(halogen.Schema):
    self = halogen.Link(attr=lambda arg: '#self')
    next = halogen.Link(attr=lambda arg: '#next')
    prev = halogen.Link(attr=lambda arg: '#prev')
    followers = halogen.Embedded(
        halogen.types.List(FollowerSchema)
    )


class LeagueSchema(halogen.Schema):
    """联赛基本数据/leagues
    
    联赛编号   leagueID     UUID
    名称       name         Text
    地区       district     JSON
    简介       intro        Text
    类型       type         Integer
    创建时间   createdTime  DateTime
    状态       status       Integer
    
    类型/type
        联赛
        杯赛
    
    Auto Generated Code.
    """
    self = halogen.Link(attr=lambda arg: '#self')
    leagueID = halogen.Attr(attr='leagueid')
    name = halogen.Attr()
    district = halogen.Attr()
    intro = halogen.Attr()
    type = halogen.Attr()
    createdTime = halogen.Attr(
        attr_type=halogen.types.ISOUTCDateTime(),
        attr='createdtime'
    )
    status = halogen.Attr()


class LeagueCollection(halogen.Schema):
    self = halogen.Link(attr=lambda arg: '#self')
    next = halogen.Link(attr=lambda arg: '#next')
    prev = halogen.Link(attr=lambda arg: '#prev')
    leagues = halogen.Embedded(
        halogen.types.List(LeagueSchema)
    )


class TeamSchema(halogen.Schema):
    """联赛球队/teams
    
    联赛编号    leagueID  UUID
    俱乐部编号  clubID    UUID
    组别        group     Text
    状态        status    Integer
    
    Auto Generated Code.
    """
    self = halogen.Link(attr=lambda arg: '#self')
    leagueID = halogen.Attr(attr='leagueid')
    clubID = halogen.Attr(attr='clubid')
    group = halogen.Attr()
    status = halogen.Attr()


class TeamCollection(halogen.Schema):
    self = halogen.Link(attr=lambda arg: '#self')
    next = halogen.Link(attr=lambda arg: '#next')
    prev = halogen.Link(attr=lambda arg: '#prev')
    teams = halogen.Embedded(
        halogen.types.List(TeamSchema)
    )


class PlayerListSchema(halogen.Schema):
    """名单/playerlists
    
    联赛编号    leagueID       UUID
    俱乐部编号  clubID         UUID
    用户编号    userID         UUID
    真实姓名    realname       Text
    出生日期    birthday       Date
    球衣背号    clubNumber     Integer
    位置        fieldPosition  Integer
    
    Auto Generated Code.
    """
    self = halogen.Link(attr=lambda arg: '#self')
    leagueID = halogen.Attr(attr='leagueid')
    clubID = halogen.Attr(attr='clubid')
    userID = halogen.Attr(attr='userid')
    realname = halogen.Attr()
    birthday = halogen.Attr(
        attr_type=halogen.types.ISOUTCDate()
    )
    clubNumber = halogen.Attr(attr='clubnumber')
    fieldPosition = halogen.Attr(attr='fieldposition')


class PlayerListCollection(halogen.Schema):
    self = halogen.Link(attr=lambda arg: '#self')
    next = halogen.Link(attr=lambda arg: '#next')
    prev = halogen.Link(attr=lambda arg: '#prev')
    playerlists = halogen.Embedded(
        halogen.types.List(PlayerListSchema)
    )


class MatchSchema(halogen.Schema):
    """球赛基本数据/matches
    
    球赛编号   matchID      UUID
    联赛编号   leagueID     UUID
    序号       session      Integer
    开始时间   startedTime  DateTime
    报名截止   deadline     DateTime
    主队       homeTeam     UUID
    客队       awayTeam     UUID
    比分       score        JSON
    MVP        MVP          UUID
    场地       site         Text
    球衣要求   shirt        Text
    注意事项   notes        Text
    创建时间   createdTime  DateTime
    类型       type         Integer
    状态       status       Integer
    
    Auto Generated Code.
    """
    self = halogen.Link(attr=lambda arg: '#self')
    matchID = halogen.Attr(attr='matchid')
    leagueID = halogen.Attr(attr='leagueid')
    session = halogen.Attr()
    startedTime = halogen.Attr(
        attr_type=halogen.types.ISOUTCDateTime(),
        attr='startedtime'
    )
    deadline = halogen.Attr(
        attr_type=halogen.types.ISOUTCDateTime()
    )
    homeTeam = halogen.Attr(attr='hometeam')
    awayTeam = halogen.Attr(attr='awayteam')
    score = halogen.Attr()
    MVP = halogen.Attr(attr='mvp')
    site = halogen.Attr()
    shirt = halogen.Attr()
    notes = halogen.Attr()
    createdTime = halogen.Attr(
        attr_type=halogen.types.ISOUTCDateTime(),
        attr='createdtime'
    )
    type = halogen.Attr()
    status = halogen.Attr()


class MatchCollection(halogen.Schema):
    self = halogen.Link(attr=lambda arg: '#self')
    next = halogen.Link(attr=lambda arg: '#next')
    prev = halogen.Link(attr=lambda arg: '#prev')
    matches = halogen.Embedded(
        halogen.types.List(MatchSchema)
    )


class LineUpSchema(halogen.Schema):
    """出场阵容/lineups
    
    球赛编号    matchID        UUID
    俱乐部编号  clubID         UUID
    用户编号    userID         UUID
    球衣背号    clubNumber     Integer
    位置        fieldPosition  Integer
    报名状态    applied        Integer
    是否到场    present        Integer
    是否首发    starting       Integer
    是否上场    field          Integer
    报名时间    createdTime    DateTime
    
    报名状态/applied
        已报名
        已请假
    
    Auto Generated Code.
    """
    self = halogen.Link(attr=lambda arg: '#self')
    matchID = halogen.Attr(attr='matchid')
    clubID = halogen.Attr(attr='clubid')
    userID = halogen.Attr(attr='userid')
    clubNumber = halogen.Attr(attr='clubnumber')
    fieldPosition = halogen.Attr(attr='fieldposition')
    applied = halogen.Attr()
    present = halogen.Attr()
    starting = halogen.Attr()
    field = halogen.Attr()
    createdTime = halogen.Attr(
        attr_type=halogen.types.ISOUTCDateTime(),
        attr='createdtime'
    )


class LineUpCollection(halogen.Schema):
    self = halogen.Link(attr=lambda arg: '#self')
    next = halogen.Link(attr=lambda arg: '#next')
    prev = halogen.Link(attr=lambda arg: '#prev')
    lineups = halogen.Embedded(
        halogen.types.List(LineUpSchema)
    )


class EventSchema(halogen.Schema):
    """球赛事件/events
    
    ID          id            UUID
    球赛编号    matchID       UUID
    俱乐部编号  clubID        UUID
    用户编号    userID        UUID
    事件        event         Integer
    时间        occurredTime  DateTime
    
    进球
        进球
        乌龙球
    红黄牌
        红牌
        黄牌
    其他
        警告
    
    Auto Generated Code.
    """
    self = halogen.Link(attr=lambda arg: '#self')
    id = halogen.Attr()
    matchID = halogen.Attr(attr='matchid')
    clubID = halogen.Attr(attr='clubid')
    userID = halogen.Attr(attr='userid')
    event = halogen.Attr()
    occurredTime = halogen.Attr(
        attr_type=halogen.types.ISOUTCDateTime(),
        attr='occurredtime'
    )


class EventCollection(halogen.Schema):
    self = halogen.Link(attr=lambda arg: '#self')
    next = halogen.Link(attr=lambda arg: '#next')
    prev = halogen.Link(attr=lambda arg: '#prev')
    events = halogen.Embedded(
        halogen.types.List(EventSchema)
    )


class SpiritBoradSchema(halogen.Schema):
    """球风记分牌/spiritborads
    
    ID          id           UUID
    联赛编号    leagueID     UUID
    俱乐部编号  clubID       UUID
    记分        point        Integer
    类型        type         Integer
    创建时间    createdTime  DateTime
    
    Auto Generated Code.
    """
    self = halogen.Link(attr=lambda arg: '#self')
    id = halogen.Attr()
    leagueID = halogen.Attr(attr='leagueid')
    clubID = halogen.Attr(attr='clubid')
    point = halogen.Attr()
    type = halogen.Attr()
    createdTime = halogen.Attr(
        attr_type=halogen.types.ISOUTCDateTime(),
        attr='createdtime'
    )


class SpiritBoradCollection(halogen.Schema):
    self = halogen.Link(attr=lambda arg: '#self')
    next = halogen.Link(attr=lambda arg: '#next')
    prev = halogen.Link(attr=lambda arg: '#prev')
    spiritborads = halogen.Embedded(
        halogen.types.List(SpiritBoradSchema)
    )


class TableSchema(halogen.Schema):
    """积分榜/tables
    
    联赛编号    leagueID     UUID
    俱乐部编号  clubID       UUID
    场数        played       Integer
    积分        points       Integer
    胜          wins         Integer
    平          draws        Integer
    负          losses       Integer
    进球        goalScored   Integer
    失球        goalAgainst  Integer
    更新时间    lastUpdated  DateTime
    
    Auto Generated Code.
    """
    self = halogen.Link(attr=lambda arg: '#self')
    leagueID = halogen.Attr(attr='leagueid')
    clubID = halogen.Attr(attr='clubid')
    played = halogen.Attr()
    points = halogen.Attr()
    wins = halogen.Attr()
    draws = halogen.Attr()
    losses = halogen.Attr()
    goalScored = halogen.Attr(attr='goalscored')
    goalAgainst = halogen.Attr(attr='goalagainst')
    lastUpdated = halogen.Attr(
        attr_type=halogen.types.ISOUTCDateTime(),
        attr='lastupdated'
    )


class TableCollection(halogen.Schema):
    self = halogen.Link(attr=lambda arg: '#self')
    next = halogen.Link(attr=lambda arg: '#next')
    prev = halogen.Link(attr=lambda arg: '#prev')
    tables = halogen.Embedded(
        halogen.types.List(TableSchema)
    )


class SpiritSchema(halogen.Schema):
    """球风榜/spirits
    
    联赛编号    leagueID  UUID
    俱乐部编号  clubID    UUID
    积分        points    Integer
    红牌        proj01    Integer
    黄牌        proj02    Integer
    警告        proj03    Integer
    列队        proj04    Integer
    队服        proj05    Integer
    鼓掌        proj06    Integer
    复盘        proj07    Integer
    海报        proj08    Integer
    投票        proj09    Integer
    
    Auto Generated Code.
    """
    self = halogen.Link(attr=lambda arg: '#self')
    leagueID = halogen.Attr(attr='leagueid')
    clubID = halogen.Attr(attr='clubid')
    points = halogen.Attr()
    proj01 = halogen.Attr()
    proj02 = halogen.Attr()
    proj03 = halogen.Attr()
    proj04 = halogen.Attr()
    proj05 = halogen.Attr()
    proj06 = halogen.Attr()
    proj07 = halogen.Attr()
    proj08 = halogen.Attr()
    proj09 = halogen.Attr()


class SpiritCollection(halogen.Schema):
    self = halogen.Link(attr=lambda arg: '#self')
    next = halogen.Link(attr=lambda arg: '#next')
    prev = halogen.Link(attr=lambda arg: '#prev')
    spirits = halogen.Embedded(
        halogen.types.List(SpiritSchema)
    )


class RankSchema(halogen.Schema):
    """排行榜/ranks
    
    ID          id           UUID
    联赛编号    leagueID     UUID
    俱乐部编号  clubID       UUID
    用户编号    userID       UUID
    分值        score        Integer
    附加数据    ext          Text
    类型        type         Integer
    更新时间    lastUpdated  DateTime
    
    类型/type
        射手
        助攻
        红牌
        黄牌
    
    Auto Generated Code.
    """
    self = halogen.Link(attr=lambda arg: '#self')
    id = halogen.Attr()
    leagueID = halogen.Attr(attr='leagueid')
    clubID = halogen.Attr(attr='clubid')
    userID = halogen.Attr(attr='userid')
    score = halogen.Attr()
    ext = halogen.Attr()
    type = halogen.Attr()
    lastUpdated = halogen.Attr(
        attr_type=halogen.types.ISOUTCDateTime(),
        attr='lastupdated'
    )


class RankCollection(halogen.Schema):
    self = halogen.Link(attr=lambda arg: '#self')
    next = halogen.Link(attr=lambda arg: '#next')
    prev = halogen.Link(attr=lambda arg: '#prev')
    ranks = halogen.Embedded(
        halogen.types.List(RankSchema)
    )


class DistrictSchema(halogen.Schema):
    """行政区划/district
    
    地区编号      id           UUID
    上级地区编号  pid          UUID
    地区名称      district     Text
    行政区划代码  code         Text
    状态          status       Integer
    
    Auto Generated Code.
    """
    self = halogen.Link(attr=lambda arg: '#self')
    id = halogen.Attr()
    pid = halogen.Attr()
    district = halogen.Attr()
    code = halogen.Attr()
    status = halogen.Attr()


class DistrictCollection(halogen.Schema):
    self = halogen.Link(attr=lambda arg: '#self')
    next = halogen.Link(attr=lambda arg: '#next')
    prev = halogen.Link(attr=lambda arg: '#prev')
    districts = halogen.Embedded(
        halogen.types.List(DistrictSchema)
    )
